<template>
  <div>
    <p class="pls">人气排行</p>
    <ul class="ul3">
      <li @click="ranksho(
      item)" v-for="(item,index) in rankData" :key="index">
        <div class="s-left">
          <img :src="item.avatar" alt="">
          <span>{{item.user_login}}</span>
        </div>
        <span>{{item.vote}}票</span>
      </li>
    </ul>

    <ul class="ul2">
      <li v-for="(item,index) in data" :key="index">
        <router-link :to="item.path">
          {{item.txt}}<p v-if="$route.params.id2==index"></p>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  import * as list from "../../../api/list.js";
  export default {
    name: "Ranking",
    data(){
      return {
        rankData:[],
        data:[
          {path:'/vote/4/showout/0/'+this.$route.params.id3,txt:'节目排行'},
          {path:'/vote/4/ranking/1/'+this.$route.params.id3,txt:'人气排行'},
          {path:'/vote/4/voting/2/'+this.$route.params.id3,txt:'投票说明'}
        ]
      }
    },
    beforeMount(){
      let parmes5 = {active_id:this.$route.params.id3,type:2};
      list.voteRank(parmes5).then(res=>{
        console.log('人气',res.data);
        this.rankData = res.data;
      })
    },
    mounted(){
      mui.back = function() {
        window.history.go(-1);
      }
    },
    methods:{
      ranksho(item){
        this.$router.push('/vote/4/rankshow/'+item.id+'/'+this.$route.params.id3)
      }
    }
  }
</script>

<style scoped>
  .pls{
    font-size: 28px;
    padding-left: 40px;
    border-bottom: 1px solid #dcdcdc;
  }
  .ul3 li{
    border-bottom: 1px solid #dcdcdc;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
  }
  .ul3 li:last-child{
    border-bottom:0;
  }
  .ul3 li .s-left{
    display: flex;
  }
  .ul3 li .s-left img{
    width: 100px;
    height: 100px;
  }
  .ul3 li .s-left span{
    font-size: 28px;
    align-self: center;
    margin-left: 20px;
  }
  .ul3 li>span{
    font-size: 24px;
    color: #fff;
    background: #e98345;
    width: 150px;
    height: 40px;
    align-self: center;
    text-align: center;
    line-height: 40px;
    border-radius: 5px;
  }

  .ul2{
    display: flex;
    justify-content: space-between;
  }
  .ul2 li{
    position: relative;
    flex-grow: 1;
    font-size: 26px;
    border-right: 1px solid #444;
    text-align: center;
  }
  .ul2 li p{
    position: absolute;
    left: 50%;
    margin-left: -52px;
    bottom: -20px;
    width: 104px;
    border: 2px solid #e98345;
  }
  .ul2 li:last-child{
    border: none;
  }
</style>
